﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Home.Master" AutoEventWireup="true" CodeBehind="ResultUnit.aspx.cs" Inherits="TimeWork.ResultUnit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Bredcrumb" runat="server">
    <li><a href="#" class="report">Quản trị</a></li>>
    <li><a href="ListStaff.aspx">Quản lý phòng ban</a></li>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<form runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager> 
    <h2>Quản lý phòng ban</h2>
    <div class="list-staff">
        <asp:UpdatePanel ID="UpdatePanel" runat="server">
            <ContentTemplate>
                <asp:GridView ID="GVListResultUnit" runat="server" AutoGenerateColumns="False" 
                DataKeyNames="ResultUnitID" 
                    onrowcancelingedit="GVListResultUnit_RowCancelingEdit" 
                    onrowdatabound="GVListResultUnit_RowDataBound" 
                    onrowdeleting="GVListResultUnit_RowDeleting" 
                    onrowediting="GVListResultUnit_RowEditing" 
                    onrowupdating="GVListResultUnit_RowUpdating">
                    <Columns>
                        <asp:TemplateField HeaderText="STT" HeaderStyle-Width="20px" HeaderStyle-HorizontalAlign="Center" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%# Container.DataItemIndex + 1 %>
                            </ItemTemplate>
                            <HeaderStyle BackColor="#F3F9FF" ForeColor="#375B91" HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tên phòng ban" HeaderStyle-HorizontalAlign="Center" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91" HeaderStyle-Width="200px">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtName" runat="server" Text='<%# Bind("ResultUnitName") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblName" runat="server" Text='<%# Eval("ResultUnitName") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle BackColor="#F3F9FF" ForeColor="#375B91" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Mã phòng ban" HeaderStyle-Width="65px" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtCode" runat="server" Text='<%# Bind("ResultUnitNameAlt") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblCode" runat="server" Text='<%# Eval("ResultUnitNameAlt") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle BackColor="#F3F9FF" ForeColor="#375B91" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Mô tả" HeaderStyle-HorizontalAlign="Center" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtDes" runat="server" Text='<%# Bind("ResultUnitDescription") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblDes" Text='<%# Eval("ResultUnitDescription") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle BackColor="#F3F9FF" ForeColor="#375B91" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField ShowHeader="False" HeaderStyle-HorizontalAlign="Center"  HeaderStyle-Width="20px">
                            <EditItemTemplate>
                                <asp:ImageButton ID="imgUpdate" runat="server" CausesValidation="true" CommandName="Update" ImageUrl="~/resources/img/icons/update.png"  ToolTip="Cập nhật" CssClass="wrap_input"></asp:ImageButton>
                                <asp:ImageButton ID="imgCancel" runat="server" CausesValidation="false" CommandName="Cancel" ImageUrl="~/resources/img/icons/cancel.png"  ToolTip="Hủy" CssClass="wrap_input"></asp:ImageButton>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:ImageButton ID="imgEdit" runat="server" CausesValidation="false" CommandName="Edit" ImageUrl="~/resources/img/icons/page_white_edit.png" ToolTip="Sửa" CssClass="wrap_input"></asp:ImageButton>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-Width="20px" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                <asp:ImageButton ID="imgDelete" runat="server" CausesValidation="true" CommandName="Delete" ImageUrl="~/resources/img/icons/delete.png"  ToolTip="Xóa" CssClass="wrap_input" OnClientClick="return confirm('Bạn chắc chắn muốn xóa đơn vị này?');"></asp:ImageButton>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <div class="info-box" style="margin:0 auto;width: 450px;">
        <h3>Thêm mới phòng ban</h3>
        <table>
            <tr>
                <td class="tdLabel">Tên phòng ban*:</td>
                <td>
                    <asp:TextBox ID="txtResultUnitName" runat="server" Width="174px"></asp:TextBox> 
                    <asp:Label ID="lblMissName" runat="server" Text="Không được bỏ trống" CssClass="validate"></asp:Label></td>
            </tr>
            <tr>
                <td class="tdLabel">Mã phòng ban:</td>
                <td>
                    <asp:TextBox ID="txtResultUnitNameAlt" runat="server" Width="100px"></asp:TextBox> 
                </td>
            </tr>
            <tr>
                <td class="tdLabel">Mô tả:</td>
                <td> 
                    <asp:TextBox ID="txtResultUnitDescription" runat="server" TextMode="MultiLine" 
                        Height="84px" Width="236px" ></asp:TextBox></td>
            </tr>
            <tr>
                <td colspan="2" align="right">
                    <asp:Button ID="btnAdd" runat="server" Text="Thêm mới" 
                            CssClass="mybutton" onclick="btnAdd_Click" />
                </td>
            </tr>
        </table>
    </div>
</form>
</asp:Content>
